import http from './http'

/**
 * 生产领料相关API
 */
export const productionMaterialRequisitionApi = {
  /**
   * 分页查询生产领料单
   * 对应后端：GET /productionMaterialRequisition/page
   */
  getPage(params) {
    return http.get('/produce/productionMaterialRequisition/page', { params })
  },

  /**
   * 根据ID查询领料单详情
   * 对应后端：GET /productionMaterialRequisition/{id}
   */
  getById(id) {
    return http.get(`/produce/productionMaterialRequisition/${id}`)
  },

  /**
   * 新增生产领料单
   * 对应后端：POST /productionMaterialRequisition/add
   */
  add(data) {
    return http.post('/produce/productionMaterialRequisition/add', data)
  },

  /**
   * 更新生产领料单
   * 对应后端：PUT /productionMaterialRequisition/update
   */
  update(data) {
    return http.put('/produce/productionMaterialRequisition/update', data)
  },

  /**
   * 删除生产领料单
   * 对应后端：DELETE /productionMaterialRequisition/{id}
   */
  remove(id) {
    return http.delete(`/produce/productionMaterialRequisition/${id}`)
  }
}

export default productionMaterialRequisitionApi
